package com.hzncc.scaffold.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.hzncc.scaffold.entity.Other.Chapter;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

/**
 * <p>
 * 章节表 Mapper 接口
 * </p>
 *
 * @author DrunkBear
 * @since 2022-04-27
 */
@Component
public interface ChapterMapper extends BaseMapper<Chapter> {

    @Select("SELECT COUNT(chapter.id)\n" +
            "FROM\n" +
            "\tchapter\n" +
            "LEFT JOIN task  ON chapter.id = task.chapterId ${ew.customSqlSegment}")
    public Integer taskCount(@Param(Constants.WRAPPER) QueryWrapper queryWrapper);

}
